const { contextBridge, ipcRenderer } = require('electron/renderer');

contextBridge.exposeInMainWorld('Title', {
  miximize: () => ipcRenderer.invoke('miximize'),
  maximize: () => ipcRenderer.invoke('maximize'),
  closeWindow: () => ipcRenderer.invoke('closeWindow'),
});

contextBridge.exposeInMainWorld('BiliAPI', {
  typeSearch: (keyword, currentPage) => ipcRenderer.invoke('biliTypeSearch', keyword, currentPage),
  getBiliAudio: (url) => ipcRenderer.invoke('getBiliAudio', url),
  getSongStream: (songInfo) => ipcRenderer.invoke('getSongStream', songInfo),
  getSongStreamUrl: (songInfo) => ipcRenderer.invoke('getSongStreamUrl', songInfo),
  searchMenu: (currentPage) => ipcRenderer.invoke('searchMenu', currentPage),
  getMenuInfo: (params) => ipcRenderer.invoke('getMenuInfo', params),
});

contextBridge.exposeInMainWorld('Operation', {
  openLink: (url) => ipcRenderer.invoke('openBrowserLink', url),
});
